﻿<!--#include file="inc/Main.asp"-->
<%
'***********************
'Code for MwCMS
'***********************
dim typeid,sortid,page,id,templatePath,infoStr
dim rsObj,sortIds,tempstr
dim sitetitle,sitedes,sitekeywords
typeid = getint(getForm("typeid", "get"),0)
sortid = getint(getForm("sortid", "get"),0)
page = getint(getForm("page", "get"),1)
tempstr=conn.db("select TemplateName from {pre}Navigation where ID="&sortid&"","1")(0)
if instr(tempstr,"|")>0 then templatePath = PubTemp&split(tempstr,"|")(0) else templatePath = PubTemp&tempstr
with templateObj : .load(templatePath) : .parseTemplate() : infoStr = .content end with
select case typeid
    case 1
	    dim seoKeyArr,i
		set rsObj = conn.db("select * from {pre}About where SortID="&SortID&"","1")
		if cint(rsObj("IsTurn"))=1 then alert "",""&rsObj("TurnUrl")&"",""
		infoStr = re(infoStr,"[show:info]",InfoPage(rsObj("Content"),typeid,sortid,id,page))
		infoStr = re(infoStr,"[show:title]",rsObj("Title"))
        infoStr = re(infoStr,"[show:date]",rsObj("AddDate"))
        infoStr = re(infoStr,"[show:hits]",rsObj("Hits"))
		infoStr = parsePower(rsObj("Power"),rsObj("PowerType"),infoStr)		
		rsObj.close
		set rsObj = nothing
		seoKeyArr=conn.db("select * from {pre}SeoLink order by len(SeoKey)","3")
		if isArray(seoKeyArr) then
		for i=0 to ubound(seoKeyArr,2)
			if isPower("1",seoKeyArr(3,i)) then
				if seoKeyArr(4,i) then
					infoStr=re(infoStr,seoKeyArr(1,i),"<span><a href='"&seoKeyArr(2,i)&"' target='_blank'>"&seoKeyArr(1,i)&"</a></span>")
				else
					infoStr=re(infoStr,seoKeyArr(1,i),"<span><a href='"&seoKeyArr(2,i)&"'>"&seoKeyArr(1,i)&"</a></span>")
				end if
			end if
		next
		end if
		conn.db "update {pre}About set Hits=Hits+1 where SortID="&SortID&"","0"
	case 2,3,4,5,6,7
		sortIds = conn.db("select ChildPath from {pre}Navigation where ID="&sortid&"","1")(0)
		with templateObj : .content = infoStr : .parseList sortIds,page,typeid,"" : infoStr = .content end with
end select
infoStr = re(infoStr,"{ideacms:smalltype}",TName(SortID))
infoStr = re(infoStr,"{ideacms:bigtype}",TName(GetTopId(SortID)))
infoStr = re(infoStr,"{ideacms:navpic}",NavInfo(1,SortID))
infoStr = re(infoStr,"{ideacms:navinfo}",NavInfo(2,SortID))
infoStr = re(infoStr,"{ideacms:topsort}",GetTopId(SortID))
infoStr = re(infoStr,"{ideacms:cursort}",SortID)
sitetitle=conn.db("select SeoTitle from {pre}Navigation where ID="&sortid&"","1")(0)
sitedes=conn.db("select SeoDes from {pre}Navigation where ID="&sortid&"","1")(0)
sitekeywords=conn.db("select SeoKeys from {pre}Navigation where ID="&sortid&"","1")(0)
if not isnul(sitetitle) then infoStr = re(infoStr,"{ideacms:sitetitle}",sitetitle)
if not isnul(sitedes) then infoStr = re(infoStr,"{ideacms:sitedes}",filterStr(sitedes))
if not isnul(sitekeywords) then infoStr = re(infoStr,"{ideacms:sitekeywords}",sitekeywords)
infoStr = getPath(SortID,infoStr,"list")
with templateObj : .content = infoStr : .parseComm() : infoStr = .content end with
Echo infoStr
terminateAllObjects
%>